package models

import "gorm.io/gorm"

type Goods struct {
	gorm.Model
	Title  string  `gorm:"type:varchar(30)"`
	UserId int     `gorm:"type:int(11)"`
	Price  float64 `gorm:"type:decimal(10,2)"`
}

func (g *Goods) GoodsAdd(db *gorm.DB) error {
	return db.Debug().Create(g).Error
}

func (g *Goods) DetailGoods(db *gorm.DB, id int64) error {
	return db.Debug().Where("id=?", id).First(g).Error
}
